#!/opt/local/bin/python
import sys

old_uid = None

for l in sys.stdin:
    l = l.strip()
    p = l.split()
    uid = p[0]
    rating = int(p[1])
    
    if old_uid is None:
        old_uid = uid
        p_count = 0
        n_count = 0

    if old_uid == uid:
        if rating == 1:
            p_count += 1
        elif rating == -1:
            n_count += 1
    else:
        print old_uid , p_count , n_count
        p_count = 0
        n_count = 0
        old_uid = uid
print old_uid , p_count, n_count
